home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGSCAL / EXTMEM.LZH / XMEMCOPY.C < prev    next >
Text File  |  1987-09-14  |  830b  |  49 lines

  1. #include <dos.h>
  2.  
  3. struct DESC
  4.     {
  5.     unsigned limit;
  6.     unsigned base_lo;
  7.     unsigned char base_hi;
  8.     unsigned char rights;
  9.     unsigned reserved;
  10.     };
  11.  
  12. struct GDT
  13.     {
  14.     struct DESC
  15.         dummy,
  16.         gdt_desc,
  17.         src,
  18.         tgt,
  19.         bios_cs,
  20.         st_reg;
  21.     };
  22.  
  23. static struct GDT gdt = {   { 0,0,0,0x93,0 },
  24.                             { 0,0,0,0x93,0 },
  25.                             { 0,0,0,0x93,0 },
  26.                             { 0,0,0,0x93,0 },
  27.                             { 0,0,0,0x93,0 },
  28.                             { 0,0,0,0x93,0 }
  29.                         };
  30.  
  31. unsigned copy( unsigned long source, unsigned long dest, unsigned nbytes )
  32. {
  33.  
  34.     gdt.src.limit = nbytes;
  35.     gdt.src.base_lo = source % 65536;
  36.     gdt.src.base_hi = source / 65536;
  37.  
  38.     gdt.tgt.limit = nbytes;
  39.     gdt.tgt.base_lo = dest % 65536;
  40.     gdt.tgt.base_hi = dest / 65536;
  41.  
  42.     _ES = _DS;
  43.     _SI = (unsigned)&gdt;
  44.     _CX = nbytes/2;
  45.     _AH = 0x87;
  46.     geninterrupt( 0x15 );
  47.     return( _AH );
  48. }
  49.